import request from '@/utils/request'

export function listRole(query) {
  return request({
    url: '/sys/role/list',
    method: 'get',
    params: query
  })
}

export function createRole(data) {
  return request({
    url: '/sys/role/create',
    method: 'post',
    data
  })
}

export function readRole(data) {
  return request({
    url: '/sys/role/read/' + data.id,
    method: 'get'
  })
}

export function updateRole(data) {
  return request({
    url: '/sys/role/update',
    method: 'post',
    data
  })
}

export function deleteRole(data) {
  return request({
    url: '/sys/role/delete/' + data.id,
    method: 'delete'
  })
}

export function getPermissions(roleId) {
  return request({
    // url: '/sys/role/permissions/' + roleId,
    url: '/screen/permissions/' + roleId,
    method: 'get'
  })
}

export function updatePermission(data) {
  return request({
    url: '/sys/role/assign',
    method: 'post',
    data
  })
}

export function roleOptions(query) {
  return request({
    url: '/sys/role/options',
    method: 'get',
    params: query
  })
}

export function fsiteNoBelongOptions(query) {
  return request({
    url: '/sys/role/fsiteNoBelongOptions',
    method: 'get',
    params: query
  })
}
